#encoding:utf-8

import unittest
from hero import *
from equip import *

class TestBest(unittest.TestCase):
    
    def test_best(self):
        player1 = Hero(name="狄洛",vitality=20,power=20,strength=20,intellect=10,speed=10)
        player1.position = (0,0)
        print "狄洛离开新手村去大陆上去冒险"
        gbl = Enemy(1,150,150,40,25,20,name=u'哥布林')
        gbl.position = (0,1)
        print "当走到一片森林中时, 突然从森林中窜出一只哥布林"
        player1.setEquip(Equips(0, name=u'长剑', level=1, atk=10))
        player1.setEquip(Equips(1, name=u'帽子', level=1, defend=1))
        player1.setEquip(Equips(2, name=u'肩膀', level=1, atk=2, defend=2))
        player1.setEquip(Equips(3, name=u'衣服', level=1, vitality=1, maxhp=20, defend=2))
        player1.setEquip(Equips(4, name=u'裤子', level=1, strength=2, intellect=1))
        player1.setEquip(Equips(5, name=u'鞋子', level=1, speed=2, strength=2))
        print "狄洛装备上长剑,帽子,肩膀,衣服,裤子,鞋子实力大涨"
        print "生命值%s, 魔法值%s, 攻击力%s, 防御力%s"%(player1.maxhp, player1.maxmp, player1.atk, player1.defend)
        print "战斗开始"
        for i in range(20):
            player1.attack(gbl)
            print "狄洛攻击哥布林,造成%s点伤害"%player1.harm
            if gbl.hp == 0: 
                print "哥布林已死亡"
                break
            gbl.attack(player1)
            print "哥布林攻击狄洛,造成%s点伤害"%gbl.harm      
        print "战斗结束"
        print "狄洛消灭哥布林后信心大增, 决定深入到森林深处去冒险"
        print "一路上魔兽倍出, 狄洛一路上过五关斩六将, 终于在天黑前发现了一个藏宝洞穴"
        print "狄洛急忙向洞穴跑去, 突然, 四周传来一阵吼声"
        bossYda = Enemy(50,3000,3000,80,500,30,name='尤迪安')
        bossYda.position = (0,1)
        print "尤迪安凭空出现:'闯入者,你这是自寻死路'"
        print "boss战斗开始"
        for i in range(20):
            player1.attack(bossYda)
            print "狄洛攻击尤迪安,造成%s点伤害"%player1.harm
            bossYda.attack(player1)
            print "尤迪安攻击狄洛,造成%s点伤害"%bossYda.harm
            if player1.hp == 0:
                print "狄洛死亡"
                break
        print "战斗结束"
        print "GameOver(由于主角平时不信春哥,导致无法满状态原地复活)"
        print "欲知后续如何,尽请关注light and darkness v2.0"
    
if __name__ == '__main__':
    unittest.main()